<template>
  <view class="page-container">
    <scroll-view class="content" scroll-y>
      <!-- 分享任务 -->
      <view class="task-card">
        <view class="task-header">
          <text class="task-title">分享小程序</text>
          <view class="task-tags">
            <view class="task-tag hot">Hot</view>
            <view class="task-tag up">UP</view>
          </view>
        </view>
        <view class="task-desc">每天分享奖励一次下载次数</view>
        <view class="task-action">
          <view class="btn-primary invite-btn">去分享</view>
        </view>
      </view>
      
      <view class="prompt-text">
        <text>完成任务获得额外奖励</text>
      </view>
    </scroll-view>
  </view>
</template>

<script>
export default {
  methods: {
    switchTab(tabName) {
      if (tabName === 'index') {
        uni.switchTab({ url: '/pages/index/index' })
      } else if (tabName === 'user') {
        uni.switchTab({ url: '/pages/user/user' })
      }
    }
  }
}
</script>

<style scoped>
.page-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  background-color: #f5f5f5;
}

.content {
  flex: 1;
  padding: 15px;
  background-color: #f5f5f5;
  box-sizing: border-box;
}

.prompt-text {
  text-align: center;
  margin-bottom: 15px;
  color: #666;
  font-size: 14px;
}

.task-card {
  background-color: white;
  border-radius: 12px;
  padding: 12px;
  margin: 0 0 12px 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: transform 0.3s ease;
  overflow: hidden;
  position: relative;
  width: 100%;
  box-sizing: border-box;
}

.task-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 6px;
}

.task-desc {
  font-size: 13px;
  color: #666;
  margin-bottom: 10px;
  line-height: 1.4;
}

.task-card:active {
  transform: scale(0.98);
}

.task-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.task-title {
  font-weight: bold;
  font-size: 16px;
  color: #333;
  flex: 1;
}

.task-desc {
  font-size: 13px;
  color: #666;
  margin-bottom: 12px;
  line-height: 1.5;
}

.invite-btn {
  padding: 6px 16px;
  background-color: #2979FF;
  color: white;
  border-radius: 16px;
  font-size: 13px;
  font-weight: 500;
  transition: background-color 0.3s ease;
}

.task-tags {
  display: flex;
  gap: 6px;
}

.task-tag {
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
}

.task-tag.hot {
  background-color: #ff4757;
  color: white;
}

.task-tag.up {
  background-color: #2979FF;
  color: white;
}

.task-desc {
  font-size: 14px;
  color: #666;
  margin-bottom: 18px;
  line-height: 1.5;
}

.task-action {
  display: flex;
  justify-content: flex-end;
}

.invite-btn {
  padding: 8px 20px;
  background-color: #2979FF;
  color: white;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 500;
  transition: background-color 0.3s ease;
}

.invite-btn:active {
  background-color: #1e5fc9;
}

.tab-bar {
  display: flex;
  border-top: 1px solid #eee;
  background-color: white;
  padding: 5px 0;
}

.tab-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 0;
}

.tab-item.active {
  color: #2979FF;
}

.tab-item text {
  font-size: 12px;
  margin-top: 5px;
}
</style>